package com.fitns.user.mapper.baseConfig;

import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.fitns.user.model.baseConfig.TbVehicleArrage;

import java.util.List;
import javax.annotation.Generated;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.mybatis.dynamic.sql.delete.DeleteDSL;
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.render.RenderingStrategy;
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
import org.mybatis.dynamic.sql.select.SelectDSL;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

@Mapper
public interface TbVehicleArrageMapper {
    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
    int insert(InsertStatementProvider<TbVehicleArrage> insertStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TbVehicleArrageResult")
    TbVehicleArrage selectOne(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TbVehicleArrageResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="plate_num", property="plateNum", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="organ_id", property="organId", jdbcType=JdbcType.BIGINT),
        @Result(column="area_id", property="areaId", jdbcType=JdbcType.BIGINT),
        @Result(column="road_id", property="roadId", jdbcType=JdbcType.BIGINT),
        @Result(column="work_time", property="workTime", jdbcType=JdbcType.VARCHAR),
        @Result(column="work_require", property="workRequire", jdbcType=JdbcType.VARCHAR),
        @Result(column="fixed_time", property="fixedTime", jdbcType=JdbcType.VARCHAR),
        @Result(column="begin_time", property="beginTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="flag", property="flag", jdbcType=JdbcType.INTEGER),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_id", property="createId", jdbcType=JdbcType.BIGINT),
        @Result(column="modify_time", property="modifyTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="modify_id", property="modifyId", jdbcType=JdbcType.BIGINT)
    })
    List<TbVehicleArrage> selectMany(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
        return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
                .from(TbVehicleArrageDynamicSqlSupport.tbVehicleArrage);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbVehicleArrageDynamicSqlSupport.tbVehicleArrage);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int deleteByPrimaryKey(Long id_, String plateNum_) {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbVehicleArrageDynamicSqlSupport.tbVehicleArrage)
                .where(TbVehicleArrageDynamicSqlSupport.id, isEqualTo(id_))
                .and(TbVehicleArrageDynamicSqlSupport.plateNum, isEqualTo(plateNum_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insert(TbVehicleArrage record) {
        return insert(SqlBuilder.insert(record)
                .into(TbVehicleArrageDynamicSqlSupport.tbVehicleArrage)
                .map(TbVehicleArrageDynamicSqlSupport.plateNum).toProperty("plateNum")
                .map(TbVehicleArrageDynamicSqlSupport.organId).toProperty("organId")
                .map(TbVehicleArrageDynamicSqlSupport.areaId).toProperty("areaId")
                .map(TbVehicleArrageDynamicSqlSupport.roadId).toProperty("roadId")
                .map(TbVehicleArrageDynamicSqlSupport.workTime).toProperty("workTime")
                .map(TbVehicleArrageDynamicSqlSupport.workRequire).toProperty("workRequire")
                .map(TbVehicleArrageDynamicSqlSupport.fixedTime).toProperty("fixedTime")
                .map(TbVehicleArrageDynamicSqlSupport.beginTime).toProperty("beginTime")
                .map(TbVehicleArrageDynamicSqlSupport.endTime).toProperty("endTime")
                .map(TbVehicleArrageDynamicSqlSupport.flag).toProperty("flag")
                .map(TbVehicleArrageDynamicSqlSupport.status).toProperty("status")
                .map(TbVehicleArrageDynamicSqlSupport.remark).toProperty("remark")
                .map(TbVehicleArrageDynamicSqlSupport.createTime).toProperty("createTime")
                .map(TbVehicleArrageDynamicSqlSupport.createId).toProperty("createId")
                .map(TbVehicleArrageDynamicSqlSupport.modifyTime).toProperty("modifyTime")
                .map(TbVehicleArrageDynamicSqlSupport.modifyId).toProperty("modifyId")
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insertSelective(TbVehicleArrage record) {
        return insert(SqlBuilder.insert(record)
                .into(TbVehicleArrageDynamicSqlSupport.tbVehicleArrage)
                .map(TbVehicleArrageDynamicSqlSupport.plateNum).toPropertyWhenPresent("plateNum", record::getPlateNum)
                .map(TbVehicleArrageDynamicSqlSupport.organId).toPropertyWhenPresent("organId", record::getOrganId)
                .map(TbVehicleArrageDynamicSqlSupport.areaId).toPropertyWhenPresent("areaId", record::getAreaId)
                .map(TbVehicleArrageDynamicSqlSupport.roadId).toPropertyWhenPresent("roadId", record::getRoadId)
                .map(TbVehicleArrageDynamicSqlSupport.workTime).toPropertyWhenPresent("workTime", record::getWorkTime)
                .map(TbVehicleArrageDynamicSqlSupport.workRequire).toPropertyWhenPresent("workRequire", record::getWorkRequire)
                .map(TbVehicleArrageDynamicSqlSupport.fixedTime).toPropertyWhenPresent("fixedTime", record::getFixedTime)
                .map(TbVehicleArrageDynamicSqlSupport.beginTime).toPropertyWhenPresent("beginTime", record::getBeginTime)
                .map(TbVehicleArrageDynamicSqlSupport.endTime).toPropertyWhenPresent("endTime", record::getEndTime)
                .map(TbVehicleArrageDynamicSqlSupport.flag).toPropertyWhenPresent("flag", record::getFlag)
                .map(TbVehicleArrageDynamicSqlSupport.status).toPropertyWhenPresent("status", record::getStatus)
                .map(TbVehicleArrageDynamicSqlSupport.remark).toPropertyWhenPresent("remark", record::getRemark)
                .map(TbVehicleArrageDynamicSqlSupport.createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
                .map(TbVehicleArrageDynamicSqlSupport.createId).toPropertyWhenPresent("createId", record::getCreateId)
                .map(TbVehicleArrageDynamicSqlSupport.modifyTime).toPropertyWhenPresent("modifyTime", record::getModifyTime)
                .map(TbVehicleArrageDynamicSqlSupport.modifyId).toPropertyWhenPresent("modifyId", record::getModifyId)
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbVehicleArrage>>> selectByExample() {
        return SelectDSL.selectWithMapper(this::selectMany, TbVehicleArrageDynamicSqlSupport.id, TbVehicleArrageDynamicSqlSupport.plateNum, TbVehicleArrageDynamicSqlSupport.organId, TbVehicleArrageDynamicSqlSupport.areaId, TbVehicleArrageDynamicSqlSupport.roadId, TbVehicleArrageDynamicSqlSupport.workTime, TbVehicleArrageDynamicSqlSupport.workRequire, TbVehicleArrageDynamicSqlSupport.fixedTime, TbVehicleArrageDynamicSqlSupport.beginTime, TbVehicleArrageDynamicSqlSupport.endTime, TbVehicleArrageDynamicSqlSupport.flag, TbVehicleArrageDynamicSqlSupport.status, TbVehicleArrageDynamicSqlSupport.remark, TbVehicleArrageDynamicSqlSupport.createTime, TbVehicleArrageDynamicSqlSupport.createId, TbVehicleArrageDynamicSqlSupport.modifyTime, TbVehicleArrageDynamicSqlSupport.modifyId)
                .from(TbVehicleArrageDynamicSqlSupport.tbVehicleArrage);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbVehicleArrage>>> selectDistinctByExample() {
        return SelectDSL.selectDistinctWithMapper(this::selectMany, TbVehicleArrageDynamicSqlSupport.id, TbVehicleArrageDynamicSqlSupport.plateNum, TbVehicleArrageDynamicSqlSupport.organId, TbVehicleArrageDynamicSqlSupport.areaId, TbVehicleArrageDynamicSqlSupport.roadId, TbVehicleArrageDynamicSqlSupport.workTime, TbVehicleArrageDynamicSqlSupport.workRequire, TbVehicleArrageDynamicSqlSupport.fixedTime, TbVehicleArrageDynamicSqlSupport.beginTime, TbVehicleArrageDynamicSqlSupport.endTime, TbVehicleArrageDynamicSqlSupport.flag, TbVehicleArrageDynamicSqlSupport.status, TbVehicleArrageDynamicSqlSupport.remark, TbVehicleArrageDynamicSqlSupport.createTime, TbVehicleArrageDynamicSqlSupport.createId, TbVehicleArrageDynamicSqlSupport.modifyTime, TbVehicleArrageDynamicSqlSupport.modifyId)
                .from(TbVehicleArrageDynamicSqlSupport.tbVehicleArrage);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default TbVehicleArrage selectByPrimaryKey(Long id_, String plateNum_) {
        return SelectDSL.selectWithMapper(this::selectOne, TbVehicleArrageDynamicSqlSupport.id, TbVehicleArrageDynamicSqlSupport.plateNum, TbVehicleArrageDynamicSqlSupport.organId, TbVehicleArrageDynamicSqlSupport.areaId, TbVehicleArrageDynamicSqlSupport.roadId, TbVehicleArrageDynamicSqlSupport.workTime, TbVehicleArrageDynamicSqlSupport.workRequire, TbVehicleArrageDynamicSqlSupport.fixedTime, TbVehicleArrageDynamicSqlSupport.beginTime, TbVehicleArrageDynamicSqlSupport.endTime, TbVehicleArrageDynamicSqlSupport.flag, TbVehicleArrageDynamicSqlSupport.status, TbVehicleArrageDynamicSqlSupport.remark, TbVehicleArrageDynamicSqlSupport.createTime, TbVehicleArrageDynamicSqlSupport.createId, TbVehicleArrageDynamicSqlSupport.modifyTime, TbVehicleArrageDynamicSqlSupport.modifyId)
                .from(TbVehicleArrageDynamicSqlSupport.tbVehicleArrage)
                .where(TbVehicleArrageDynamicSqlSupport.id, isEqualTo(id_))
                .and(TbVehicleArrageDynamicSqlSupport.plateNum, isEqualTo(plateNum_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(TbVehicleArrage record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleArrageDynamicSqlSupport.tbVehicleArrage)
                .set(TbVehicleArrageDynamicSqlSupport.plateNum).equalTo(record::getPlateNum)
                .set(TbVehicleArrageDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbVehicleArrageDynamicSqlSupport.areaId).equalTo(record::getAreaId)
                .set(TbVehicleArrageDynamicSqlSupport.roadId).equalTo(record::getRoadId)
                .set(TbVehicleArrageDynamicSqlSupport.workTime).equalTo(record::getWorkTime)
                .set(TbVehicleArrageDynamicSqlSupport.workRequire).equalTo(record::getWorkRequire)
                .set(TbVehicleArrageDynamicSqlSupport.fixedTime).equalTo(record::getFixedTime)
                .set(TbVehicleArrageDynamicSqlSupport.beginTime).equalTo(record::getBeginTime)
                .set(TbVehicleArrageDynamicSqlSupport.endTime).equalTo(record::getEndTime)
                .set(TbVehicleArrageDynamicSqlSupport.flag).equalTo(record::getFlag)
                .set(TbVehicleArrageDynamicSqlSupport.status).equalTo(record::getStatus)
                .set(TbVehicleArrageDynamicSqlSupport.remark).equalTo(record::getRemark)
                .set(TbVehicleArrageDynamicSqlSupport.createTime).equalTo(record::getCreateTime)
                .set(TbVehicleArrageDynamicSqlSupport.createId).equalTo(record::getCreateId)
                .set(TbVehicleArrageDynamicSqlSupport.modifyTime).equalTo(record::getModifyTime)
                .set(TbVehicleArrageDynamicSqlSupport.modifyId).equalTo(record::getModifyId);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(TbVehicleArrage record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleArrageDynamicSqlSupport.tbVehicleArrage)
                .set(TbVehicleArrageDynamicSqlSupport.plateNum).equalToWhenPresent(record::getPlateNum)
                .set(TbVehicleArrageDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbVehicleArrageDynamicSqlSupport.areaId).equalToWhenPresent(record::getAreaId)
                .set(TbVehicleArrageDynamicSqlSupport.roadId).equalToWhenPresent(record::getRoadId)
                .set(TbVehicleArrageDynamicSqlSupport.workTime).equalToWhenPresent(record::getWorkTime)
                .set(TbVehicleArrageDynamicSqlSupport.workRequire).equalToWhenPresent(record::getWorkRequire)
                .set(TbVehicleArrageDynamicSqlSupport.fixedTime).equalToWhenPresent(record::getFixedTime)
                .set(TbVehicleArrageDynamicSqlSupport.beginTime).equalToWhenPresent(record::getBeginTime)
                .set(TbVehicleArrageDynamicSqlSupport.endTime).equalToWhenPresent(record::getEndTime)
                .set(TbVehicleArrageDynamicSqlSupport.flag).equalToWhenPresent(record::getFlag)
                .set(TbVehicleArrageDynamicSqlSupport.status).equalToWhenPresent(record::getStatus)
                .set(TbVehicleArrageDynamicSqlSupport.remark).equalToWhenPresent(record::getRemark)
                .set(TbVehicleArrageDynamicSqlSupport.createTime).equalToWhenPresent(record::getCreateTime)
                .set(TbVehicleArrageDynamicSqlSupport.createId).equalToWhenPresent(record::getCreateId)
                .set(TbVehicleArrageDynamicSqlSupport.modifyTime).equalToWhenPresent(record::getModifyTime)
                .set(TbVehicleArrageDynamicSqlSupport.modifyId).equalToWhenPresent(record::getModifyId);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKey(TbVehicleArrage record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleArrageDynamicSqlSupport.tbVehicleArrage)
                .set(TbVehicleArrageDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbVehicleArrageDynamicSqlSupport.areaId).equalTo(record::getAreaId)
                .set(TbVehicleArrageDynamicSqlSupport.roadId).equalTo(record::getRoadId)
                .set(TbVehicleArrageDynamicSqlSupport.workTime).equalTo(record::getWorkTime)
                .set(TbVehicleArrageDynamicSqlSupport.workRequire).equalTo(record::getWorkRequire)
                .set(TbVehicleArrageDynamicSqlSupport.fixedTime).equalTo(record::getFixedTime)
                .set(TbVehicleArrageDynamicSqlSupport.beginTime).equalTo(record::getBeginTime)
                .set(TbVehicleArrageDynamicSqlSupport.endTime).equalTo(record::getEndTime)
                .set(TbVehicleArrageDynamicSqlSupport.flag).equalTo(record::getFlag)
                .set(TbVehicleArrageDynamicSqlSupport.status).equalTo(record::getStatus)
                .set(TbVehicleArrageDynamicSqlSupport.remark).equalTo(record::getRemark)
                .set(TbVehicleArrageDynamicSqlSupport.createTime).equalTo(record::getCreateTime)
                .set(TbVehicleArrageDynamicSqlSupport.createId).equalTo(record::getCreateId)
                .set(TbVehicleArrageDynamicSqlSupport.modifyTime).equalTo(record::getModifyTime)
                .set(TbVehicleArrageDynamicSqlSupport.modifyId).equalTo(record::getModifyId)
                .where(TbVehicleArrageDynamicSqlSupport.id, isEqualTo(record::getId))
                .and(TbVehicleArrageDynamicSqlSupport.plateNum, isEqualTo(record::getPlateNum))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKeySelective(TbVehicleArrage record) {
        return UpdateDSL.updateWithMapper(this::update, TbVehicleArrageDynamicSqlSupport.tbVehicleArrage)
                .set(TbVehicleArrageDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbVehicleArrageDynamicSqlSupport.areaId).equalToWhenPresent(record::getAreaId)
                .set(TbVehicleArrageDynamicSqlSupport.roadId).equalToWhenPresent(record::getRoadId)
                .set(TbVehicleArrageDynamicSqlSupport.workTime).equalToWhenPresent(record::getWorkTime)
                .set(TbVehicleArrageDynamicSqlSupport.workRequire).equalToWhenPresent(record::getWorkRequire)
                .set(TbVehicleArrageDynamicSqlSupport.fixedTime).equalToWhenPresent(record::getFixedTime)
                .set(TbVehicleArrageDynamicSqlSupport.beginTime).equalToWhenPresent(record::getBeginTime)
                .set(TbVehicleArrageDynamicSqlSupport.endTime).equalToWhenPresent(record::getEndTime)
                .set(TbVehicleArrageDynamicSqlSupport.flag).equalToWhenPresent(record::getFlag)
                .set(TbVehicleArrageDynamicSqlSupport.status).equalToWhenPresent(record::getStatus)
                .set(TbVehicleArrageDynamicSqlSupport.remark).equalToWhenPresent(record::getRemark)
                .set(TbVehicleArrageDynamicSqlSupport.createTime).equalToWhenPresent(record::getCreateTime)
                .set(TbVehicleArrageDynamicSqlSupport.createId).equalToWhenPresent(record::getCreateId)
                .set(TbVehicleArrageDynamicSqlSupport.modifyTime).equalToWhenPresent(record::getModifyTime)
                .set(TbVehicleArrageDynamicSqlSupport.modifyId).equalToWhenPresent(record::getModifyId)
                .where(TbVehicleArrageDynamicSqlSupport.id, isEqualTo(record::getId))
                .and(TbVehicleArrageDynamicSqlSupport.plateNum, isEqualTo(record::getPlateNum))
                .build()
                .execute();
    }
}